﻿@using LY.Entity
@{
    Layout = "~/Areas/Admin/Views/Shared/_LayoutCMS.cshtml";
    ViewBag.Title = "审核项目信息";
    List<T_Document> list = ViewBag.Document;
    QJ.CMS.Areas.Admin.Controllers.T_ProjectController.rlist.Clear();//刷新页面时清除静态变量中缓存的值
}
@section htmlhead{
    <link href="~/Content/assets/css/Layout/css/main.css" rel="stylesheet" />
    @*<script src="~/Content/assets/js/swfobject.js"></script>*@
    @*<script src="~/Content/assets/js/jquery.uploadify.v2.1.4.js"></script>
    <script src="~/Content/editor/lang/zh_CN.js"></script>
    <script src="~/Content/assets/layer/layer.min.js"></script>
    <script src="~/webuploader/ImageJS.js"></script>*@
}
@model LY.Entity.Entities.T_Project_EX
<div class="container">
    <div id="forms" class="mt10">
        <div class="box">
            <div class="box_border">
                <div class="box_top"><b class="pl15">@ViewBag.Title</b></div>
                <div class="box_center">
                    <form  id="frmEdit" method="post" action="@Url.Action("ProjectSave")" role="form" class="jqtransform">
                        <input id="id" name="id" value="@Model.ID" type="hidden" />
                        <input id="wid" name="wid" value="@Model.wid" type="hidden" />
                        <input id="rid" name="rid" value="@Model.rid" type="hidden" />
                        <input id="hideEName" name="hideEName" value="" type="hidden" />
                        <input id="Eid" name="Eid" value="@Model.EnterpriseID" type="hidden" />
                        <input id="LoanUser" name="LoanUser" value="@Model.LoanUser" type="hidden" />
                        
                        <table class="form_table pt15 pb15" style="width: 100%;" border="0">
                            <tr>
                                <td class="td_right">项目编号：</td>
                                <td class="">@Model.ProjectNo</td>
                                <td class="td_right">项目名称：</td>
                                <td class="">@Model.ProjectName</td>
                            </tr>
                            <tr>
                                <td class="td_right">借款总额：</td>
                                <td class="">@Model.TotalLoan</td>
                                <td class="td_right">项目期限：</td>
                                <td class="">@Model.ProjectDuration
                                    @if (Model.DurationMonthOrDay == 1)
                                    {
                                        <span>月</span>
                                    }
                                    else
                                    {
                                        <span>天</span>
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">项目拆标：</td>
                                <td class="">
                                    @if (Model.SubProject == 1)
                                    {
                                        <span>是</span>
                                    }
                                    else
                                    {
                                        <span>否</span>
                                    }
                                </td>
                                <td class="td_right">新手项目：</td>
                                <td class="">
                                    @if (Model.IsNewProject == 1)
                                    {
                                        <span>是</span>
                                    }
                                    else
                                    {
                                        <span>否</span>
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">每标金额：</td>
                                <td class="">@Model.EachSubProjectAmount</td>
                                <td class="td_right">最低额度：</td>
                                <td class="">@Model.MinTenderAmount</td>
                            </tr>
                            <tr>
                                <td class="td_right">年化利率：</td>
                                <td class="">@(Model.AnnualisedRates * 100)%</td>
                                <td class="td_right">企业名称：</td>
                                <td class="">@ViewBag.EnterpriseName</td>
                            </tr>
                            <tr>
                                <td class="td_right">企业代理人：</td>
                                <td class="">@Model.EnterpriseAgent</td>
                                <td class="td_right">项目位置：</td>
                                <td class="">@Model.ProjectLocation</td>
                            </tr>
                            <tr>
                                <td class="td_right">项目开始时间：</td>
                                <td class="">@Model.ProjectBeginDate
                                </td>
                                <td class="td_right">投标截止时间：</td>
                                <td class="">@Model.ProjectEndDate</td>
                            </tr>
                            <tr>
                                <td class="td_right">还款来源：</td>
                                <td class="">@Model.RepaymentSource</td>
                                <td class="td_right">还款类型：</td>
                                <td class="">
                                    @if (Model.RepaymentType == 1)
                                    {
                                        <span>付息还本</span>
                                    }
                                    else
                                    {
                                        <span>付息还本</span>
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">借款用途：</td>
                                <td class="">@Model.LoanPurpose</td>
                                <td class="td_right">借款类型：</td>
                                <td class="">
                                    @if (Model.LoanType == 1)
                                    {
                                        <span>企业经营贷</span>
                                    }
                                    else
                                    {
                                        <span>企业经营贷</span>
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td><b class="pl15">风控信息</b></td>
                            </tr>
                            <tr>
                                <td class="td_right">担保方：</td>
                                <td class="">@Model.AssuranceProvider</td>
                                <td class="td_right">担保情况：</td>
                                <td class="">@Model.AssuranceSituation</td>
                            </tr>
                            <tr>
                                <td class="td_right">风控详情：</td>
                                <td class="" colspan="3">@Html.Raw(@Model.FKRemark)</td>
                            </tr>
                            <tr>
                                <td><b class="pl15 td_right">相关文件：</b></td>
                                <td class="" colspan="3">
                                    @if (list != null)
                                    {
                                        for (var i = 0; i < list.Count; i++)
                                        {
                                            if (list[i].Type == 1)
                                            {
                                                <img alt="" src="@list[i].DocPath" width="100px" height="100px"/>
                                            }
                                        }
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td><b class="pl15 td_right">实地照片：</b></td>
                                <td class="" colspan="3">
                                    @if (list != null)
                                    {
                                        for (var i = 0; i < list.Count; i++)
                                        {
                                            if (list[i].Type == 2)
                                            {
                                                <img src="@list[i].DocPath" width="100px" height="100px"/>
                                            }
                                        }
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td><b class="pl15 td_right">货后跟踪：</b></td>
                                <td class="" colspan="3">
                                    @if (list != null)
                                    {
                                        for (var i = 0; i < list.Count; i++)
                                        {
                                            if (list[i].Type == 3)
                                            {
                                                <img src="@list[i].DocPath" width="100px" height="100px"/>
                                            }
                                        }
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td><b class="pl15 td_right">保证合同：</b></td>
                                <td class="" colspan="3">
                                    @if (list != null)
                                    {
                                        for (var i = 0; i < list.Count; i++)
                                        {
                                            if (list[i].Type == 4)
                                            {
                                                <img src="@list[i].DocPath" width="100px" height="100px"/>
                                            }
                                        }
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td><b class="pl15 td_right">承租人证件：</b></td>
                                <td class="" colspan="3">
                                    @if (list != null)
                                    {
                                        for (var i = 0; i < list.Count; i++)
                                        {
                                            if (list[i].Type == 5)
                                            {
                                                <img src="@list[i].DocPath" width="100px" height="100px"/>
                                            }
                                        }
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td><b class="pl15 td_right">其他：</b></td>
                                <td class="" colspan="3">
                                    @if (list != null)
                                    {
                                        for (var i = 0; i < list.Count; i++)
                                        {
                                            if (list[i].Type == 6)
                                            {
                                                <img src="@list[i].DocPath" width="100px" height="100px"/>
                                            }
                                        }
                                    }
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">借款状态：</td>
                                <td class="">
                                    <input id="LoanStatu" disabled="disabled" value="@Model.LoanStatu"/>
                                </td>
                                <td class="td_right">还款状态：</td>
                                <td class="">
                                    <input id="RepaymentStatu" disabled="disabled" value="@Model.RepaymentStatu"/>
                                </td>
                            </tr>
                            <tr>
                                <td class="td_right">借款日期：</td>
                                <td class="">@Model.LoanTime</td>
                                <td class="td_right">借款人：</td>
                                <td class="">@Model.LoanUser</td>
                            </tr>
                            <tr>
                                <td><b class="pl15 td_right">项目审核</b></td>
                            </tr>
                            <tr>
                                <td class="td_right">审核说明：</td>
                                <td class="" colspan="3">@Model.AuditExplain</td>
                            </tr>
                            <tr>
                                <td class="td_right">审核日期：</td>
                                @*<td class="">@Model.AuditTime</td>*@
                                <td class=""><input id="AuditExplain" value="@Model.AuditExplain"/></td>
                                <td class="td_right">审核人：</td>
                                @*<td class="">@ViewBag.UserName</td>*@
                                <td class=""><input id="AuditUser" value="@ViewBag.LoginUser"/></td>
                            </tr>
                            <tr>
                                <td class="td_right"></td>
                                <td class=""></td>
                            </tr>
                            <tr>
                                <td class="td_center" colspan="5">
                                    <input type="button" id="btnBack" name="button" style="margin-right: 50px;" class="btn btn82 btn_save2" value="退回">
                                    <input type="button" id="btnAudit" name="button" style="margin-right: 50px;" class="btn btn82 btn_save2" value="通过">
                                    <input type="button" id="btnReturn" name="button" class="btn btn82 btn_res" value="返回">
                                </td>
                            </tr>
                        </table>
                        
                        
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@section jssection{
    <script type="text/javascript"> 
        var util = {};
        var options = {
            Audit: "@Url.Action("Audit")",
            ReturnBack: "@Url.Action("ReturnBack")",
            companyUrl: "@Url.Action("CompanyIndex")"//获取企业名称
        };

        //审核通过
        $("#btnAudit").click(function (e) {
            //$.post(options.Audit, { id: $('#id').val(), name: $('#AuditUser').val(), status: 2, Audit: $('#AuditExplain').val() },
            //  function (res) {
            //      if (res > 0) {
            //          alert("操作成功！");
            //          window.location.href = "/Admin/T_Project/ProjectAuditList";
            //      }
            //      else {
            //          alert("操作失败！");
            //      }
            //  },
            //  "json"
            //);
            $("#btnAudit").attr("disabled", true);
            if (!confirm("您确定要执行审核操作吗？")) {
                $(this).attr("disabled", false);
                return;
            }
            $.ajax({
                url: options.Audit,
                type: "Post",
                success: function (res) {
                    if (res > 0) {
                        alert("操作成功！");
                        window.location.href = "/Admin/T_Project/ProjectAuditList";
                    }
                    else {
                        alert("操作失败！");
                    }
                    $("#btnAudit").attr("disabled", false);
                },
                data: "id=" + $("#id").val() + "&name=" + $("#AuditUser").val() + "&status=2&Audit=" + $("#AuditExplain").val() //这里没有参数可以不穿
            });
        });

        //审核不通过
        $("#btnBack").click(function (e) {
            $.post(options.ReturnBack, { projectid: $('#id').val()},
              function (res) {
                  if (res > 0) {
                      alert("操作成功！");
                      window.location.href = "/Admin/T_Project/ProjectAuditList";
                  }
                  else {
                      alert("操作失败！");
                  }
              },
              "json"
            );
        });
        
        $("#btnReturn").click(function (e) {
            window.location.href = "/Admin/T_Project/ProjectAuditList";
        });
    </script>
}
